HEX
Server: Apache/2.4.68 (Debian)
System: Linux as-cs-widget-demo-us-central1 6.1.0-44-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.164-1 (2026-03-09) x86_64
User: root (0)
PHP: 8.2.32
Disabled: NONE
Upload Files
File: /var/www/kevin-demo/wp-content/plugins/woocommerce-subscriptions/assets/js/admin/admin-pointers.js
jQuery( function ( $ ) {
	let observer = null;

	if ( arePointersEnabled() ) {
		observer = new MutationObserver( showSubscriptionPointers );
	 
	 	observer.observe( document.getElementById( 'poststuff' ), {
			attributes: true,
			childList: true,
			characterData: false,
			subtree:true,
		} );
	}

	$( 'select#product-type' ).on( 'change', function () {
		if ( arePointersEnabled() ) {
			$( '#product-type' ).pointer( 'close' );
		}
	} );

	$(
		'#_subscription_price, #_subscription_period, #_subscription_length'
	).on( 'change', function () {
		if ( arePointersEnabled() ) {
			$( '.options_group.subscription_pricing' ).pointer( 'close' );
			$( '#product-type' ).pointer( 'close' );
		}
	} );

	function arePointersEnabled() {
		if ( $.getParameterByName( 'subscription_pointers' ) == 'true' ) {
			return true;
		} else {
			return false;
		}
	}

	function showSubscriptionPointers() {
		$( '#product-type' )
			.pointer( {
				content: WCSPointers.typePointerContent,
				position: {
					edge: 'left',
					align: 'center',
				},
				close: function () {
					if (
						$( 'select#product-type' ).val() ==
						WCSubscriptions.productType
					) {
						$(
							'.options_group.subscription_pricing:not(".subscription_sync")'
						)
							.pointer( {
								content: WCSPointers.pricePointerContent,
								position: 'bottom',
								close: function () {
									dismissSubscriptionPointer();
								},
							} )
							.pointer( 'open' );
					}
					dismissSubscriptionPointer();
				},
			} )
			.pointer( 'open' );
	}

	function dismissSubscriptionPointer() {
		$.post( ajaxurl, {
			pointer: 'wcs_pointer',
			action: 'dismiss-wp-pointer',
		} );

		if ( observer ) {
			observer.disconnect();
		}
	}
} );